package com.zx.controller.pageSkip.search;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.UnsupportedEncodingException;

/**
 * @author sunkai
 * @date 2022/8/25 0025 21:33
 * @mood zhou xun
 */
@Controller
@RequestMapping("/search/skip")
public class SearchSkip {
    @RequestMapping( "/search/id={id}")
    public String gotoType(@PathVariable int id, Model model)  {
        model.addAttribute("id","id="+id);
        return "search";
    }
    @RequestMapping( "/search/{productName}")
    public String gotoSearch(@PathVariable String productName,Model model)  {
        try {
            productName=new String(productName.getBytes("iso8859-1"),"utf-8");

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        model.addAttribute("name",productName);
        return "search";
    }
}
